package com.yanqu.road.server.cmd.activity.flowerstudy;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.FlowerStudyProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.activity.flowerstudy.CrossFlowerStudyMgr;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.server.protocol.GameProtocol;
import com.yanqu.road.utils.YanQuMessageUtils;

@Cmd(code = CrossProtocol.C_FLOWER_STUDY_EXAM_CANCEL_MATCHING,desc = "花城书房跨服取消匹配")
public class CrossFlowerCancelMatchingCmd extends CrossCommand {

    private int activityId;
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        FlowerStudyProto.FlowerStudyExamMatchingCancelReq req = FlowerStudyProto.FlowerStudyExamMatchingCancelReq.parseFrom(packet.getBytes());
        activityId = req.getActivityId();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        FlowerStudyProto.FlowerStudyExamMatchingCancelResp.Builder builder = CrossFlowerStudyMgr.cancelMatching(activityId, packet.getPlayerId());
        YanQuMessage pbMsg = YanQuMessageUtils.buildMessage(ClientProtocol.U_FLOWER_STUDY_EXAM_CANCEL_MATCHING,builder);
        MessageHelper.sendPacket(serverId,packet.getPlayerId(),pbMsg);
    }

    @Override
    public void sendData() {

    }
}
